package com.wangjw.tuling.zookeeper.own;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;

/**
 * Created by wangjianwen on 2018/12/1.
 */
public class ZooKeeperCrudTester {

    public static void main(String[] args) throws KeeperException, InterruptedException {
        ZookeeperCrud zookeeperCrud = new ZookeeperCrud();

        zookeeperCrud.createPersistent("/wangjw", "Java");

        zookeeperCrud.createEPhemeral("/wangmz", "Go");

        System.out.println(zookeeperCrud.getData("/wangjw"));

        zookeeperCrud.setData("/wangjw", "Go");

        Stat stat = zookeeperCrud.exists("/wangjw");
        System.out.println(stat.getVersion());

        zookeeperCrud.deleteRecursive("/wangjw");

        zookeeperCrud.delete("/wangjw");

        zookeeperCrud.close();
    }
}
